﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppSocketModel;
using AppSocketService.Location;
using BCGPSCommon;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BCGPSRESTful.Controllers.Phone.Location.Person
{
    /// <summary>
    /// 个人用户手机端定位信息
    /// </summary>
    [ApiExplorerSettings(GroupName = "PersonApp")]
    [Route("api/[controller]")]
    [ApiController]
    public class PhoneLocationPersonController : PhoneBaseController
    {
        private readonly ILocationPersonService locationPersonService;


        #region   构造函数 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="locationPersonService"></param>
        public PhoneLocationPersonController(ILocationPersonService locationPersonService)
        {
            this.locationPersonService = locationPersonService;
        }
        #endregion

        #region 获取设备位置
        /// <summary>
        /// 获取设备位置
        /// </summary>
        /// <param name="imei"></param>
        /// <param name="gps_map_type">地图类型</param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(LocationDto), 200)]
        public ActionResult<LocationDto> GetLocation(string imei, GpsMapType? gps_map_type = GpsMapType.GDMAP)
        {
            return locationPersonService.GetLocation(imei,gps_map_type.Value);
        }
        #endregion
    }
}